﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TTData
{
    /// <summary>
    /// The bouns card object
    /// </summary>
    public class BonusCard
    {
        public const int MAX_FINISH_GAME = 1;
        public const int MAX_ROAD_LENGTH_7 = 4;
        public const int MAX_ROAD_LENGTH_6 = 3;
        public const int MAX_ROAD_LENGTH_5 = 2;
        public const int MAX_REGION_BAIERN = 5;
        public const int MAX_REGION_BOHEM_SALZB = 4;
        public const int MAX_REGION_SCHWEIZ_TYROL = 3;
        public const int MAX_REGION_WURTT_HOHENZ = 3;
        public const int MAX_REGION_BADEN = 3;
        public const int MAX_REGION_ALL = 6;


        public const int BONUS_FINISH_GAME = 1;        
        public const int BONUS_ROAD_LENGTH_7 = 2;
        public const int BONUS_ROAD_LENGTH_6 = 3;
        public const int BONUS_ROAD_LENGTH_5 = 4;
        public const int BONUS_REGION_BAIERN = 5;
        public const int BONUS_REGION_BOHEM_SALZB = 6;
        public const int BONUS_REGION_SCHWEIZ_TYROL = 7;
        public const int BONUS_REGION_WURTT_HOHENZ = 8;
        public const int BONUS_REGION_BADEN = 9;
        public const int BONUS_REGION_ALL = 10;


        private Int32 _points;
        private Int32 _type;


        /// <summary>
        /// Create a new bonus card
        /// </summary>
        /// <param name="type">the bonus card's type</param>
        /// <param name="points">the bonus card's points count</param>
        public BonusCard(Int32 type, Int32 points)
        {
            _type = type;
            _points = points;
        }

        /// <summary>
        /// Set or get the bonus card's number of points
        /// </summary>
        public Int32 Points
        {
            get
            {
                return _points;
            }
            set
            {
                _points = value;
            }
        }

        /// <summary>
        /// Set or get the bonus card's type
        /// </summary>
        public Int32 Type
        {
            get
            {
                return _type;
            }
            set
            {
                _type = value;
            }
        }

        public String Source
        {
            get
            {
                switch (_type)
                {
                    case BONUS_FINISH_GAME:
                        return "resources/images/bonuses/finish_game.gif";
                        
                    case BONUS_REGION_ALL:
                        switch (_points)
                        {
                            case 6:
                                return "resources/images/bonuses/all_6.gif";                                
                            case 5:
                                return "resources/images/bonuses/all_5.gif";
                                
                            case 4:
                                return "resources/images/bonuses/all_4.gif";
                                
                            case 3:
                                return "resources/images/bonuses/all_3.gif";                                
                        }
                        break;
                    case BONUS_REGION_BADEN:
                        switch (_points)
                        {
                            case 3:
                                return "resources/images/bonuses/baden_3.gif";                                
                            case 2:
                                return "resources/images/bonuses/baden_2.gif";                                
                            case 1:
                                return "resources/images/bonuses/baden_1.gif";                                
                        }
                        break;
                    case BONUS_REGION_BAIERN:
                        switch (_points)
                        {
                            case 5:
                                return "resources/images/bonuses/baiern_5.gif";                              
                            case 4:
                                return "resources/images/bonuses/baiern_4.gif";                                
                            case 3:
                                return "resources/images/bonuses/baiern_3.gif";                                
                            case 2:
                                return "resources/images/bonuses/baiern_2.gif";                                
                        }
                        break;
                    case BONUS_REGION_BOHEM_SALZB:
                        switch (_points)
                        {
                            case 4:
                                return "resources/images/bonuses/salzburg_4.gif";                                
                            case 3:
                                return "resources/images/bonuses/salzburg_3.gif";                                
                            case 2:
                                return "resources/images/bonuses/salzburg_2.gif";                                
                        }
                        break;
                    case BONUS_REGION_SCHWEIZ_TYROL:
                        switch (_points)
                        {
                            case 3:
                                return "resources/images/bonuses/tyrol_3.gif";                                
                            case 2:
                                return "resources/images/bonuses/tyrol_2.gif";                                
                            case 1:
                                return "resources/images/bonuses/tyrol_1.gif";                                
                        }
                        break;
                    case BONUS_REGION_WURTT_HOHENZ:
                        switch (_points)
                        {
                            case 3:
                                return "resources/images/bonuses/wurtt_3.gif";                                
                            case 2:
                                return "resources/images/bonuses/wurtt_2.gif";                                
                            case 1:
                                return "resources/images/bonuses/wurtt_1.gif";                                
                        }
                        break;
                    case BONUS_ROAD_LENGTH_5:
                        switch (_points)
                        {
                            case 2:
                                return "resources/images/bonuses/carrige5_2.gif";
                              
                            case 1:
                                return "resources/images/bonuses/carrige5_1.gif";
                              
                        }
                        break;
                    case BONUS_ROAD_LENGTH_6:
                        switch (_points)
                        {
                            case 3:
                                return "resources/images/bonuses/carrige6_3.gif";
                              
                            case 2:
                                return "resources/images/bonuses/carrige6_2.gif";
                              
                            case 1:
                                return "resources/images/bonuses/carrige6_1.gif";
                              
                        }
                        break;
                    case BONUS_ROAD_LENGTH_7:
                        switch (_points)
                        {
                            case 4:
                                return "resources/images/bonuses/carrige7_4.gif";
                              
                            case 3:
                                return "resources/images/bonuses/carrige7_3.gif";
                              
                            case 2:
                                return "resources/images/bonuses/carrige7_2.gif";
                              
                            case 1:
                                return "resources/images/bonuses/carrige7_1.gif";
                              
                        }
                        break;
                }
                return null;
            }
        }
    }
}
